home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  27.9 KB  |  996 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    Input Sprocket 1.3
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1996-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __INPUTSPROCKET__
  18. #define __INPUTSPROCKET__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __EVENTS__
  24. #include <Events.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=power
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  50. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  51. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  52.  
  53. #ifndef USE_OLD_ISPNEED_STRUCT
  54. #define USE_OLD_ISPNEED_STRUCT 0
  55. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  56.  
  57. /* ********************* data types ********************* */
  58. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  59. typedef struct OpaqueISpElementReference*  ISpElementReference;
  60. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  61. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  62. typedef OSType                             ISpDeviceClass;
  63. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  64. typedef OSType                             ISpDeviceIdentifier;
  65. typedef OSType                             ISpElementLabel;
  66. typedef OSType                             ISpElementKind;
  67.  
  68. /* *************** errors -30420 to -30439***************** */
  69.  
  70. enum {
  71.     kISpInternalErr                = -30420,
  72.     kISpSystemListErr            = -30421,
  73.     kISpBufferToSmallErr        = -30422,
  74.     kISpElementInListErr        = -30423,
  75.     kISpElementNotInListErr        = -30424,
  76.     kISpSystemInactiveErr        = -30425,
  77.     kISpDeviceInactiveErr        = -30426,
  78.     kISpSystemActiveErr            = -30427,
  79.     kISpDeviceActiveErr            = -30428,
  80.     kISpListBusyErr                = -30429
  81. };
  82.  
  83. /* *************** resources **************** */
  84.  
  85. enum {
  86.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  87.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  88.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  89. };
  90.  
  91.  
  92. struct ISpApplicationResourceStruct {
  93.     UInt32                             flags;
  94.     UInt32                             reserved1;
  95.     UInt32                             reserved2;
  96.     UInt32                             reserved3;
  97. };
  98. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  99.  
  100. enum {
  101.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  102.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  103. };
  104.  
  105. /*
  106.  * ISpDeviceDefinition
  107.  *
  108.  * This structure provides all the available
  109.  * information for an input device within the system
  110.  *
  111.  */
  112.  
  113. struct ISpDeviceDefinition {
  114.     Str63                             deviceName;                    /* a human readable name of the device */
  115.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  116.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  117.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  118.     UInt32                             flags;                        /* status flags */
  119.     UInt32                             reserved1;
  120.     UInt32                             reserved2;
  121.     UInt32                             reserved3;
  122. };
  123. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  124.  
  125. enum {
  126.     kISpDeviceFlag_HandleOwnEmulation = 1
  127. };
  128.  
  129. /*
  130.  * ISpElementEvent, ISpElementEventPtr
  131.  *
  132.  * This is the structure that event data is passed in.
  133.  *
  134.  */
  135.  
  136. struct ISpElementEvent {
  137.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  138.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  139.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  140.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  141.     UInt32                             data;                        /* the data for this event */
  142. };
  143. typedef struct ISpElementEvent            ISpElementEvent;
  144. typedef ISpElementEvent *                ISpElementEventPtr;
  145. /*
  146.  * ISpElementInfo, ISpElementInfoPtr
  147.  *
  148.  * This is the generic definition of an element.
  149.  * Every element must contain this information.
  150.  *
  151.  */
  152.  
  153. struct ISpElementInfo {
  154.     ISpElementLabel                 theLabel;
  155.     ISpElementKind                     theKind;
  156.     Str63                             theString;
  157.     UInt32                             reserved1;
  158.     UInt32                             reserved2;
  159. };
  160. typedef struct ISpElementInfo            ISpElementInfo;
  161. typedef ISpElementInfo *                ISpElementInfoPtr;
  162.  
  163. typedef UInt32                             ISpNeedFlagBits;
  164. #if USE_OLD_ISPNEED_STRUCT
  165.  
  166. struct ISpNeed {
  167.     Str63                             name;
  168.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  169.     short                             reserved;
  170.     ISpElementKind                     theKind;
  171.     ISpElementLabel                 theLabel;
  172.     ISpNeedFlagBits                 flags;
  173.     UInt32                             reserved1;
  174.     UInt32                             reserved2;
  175.     UInt32                             reserved3;
  176. };
  177. typedef struct ISpNeed                    ISpNeed;
  178. #else
  179.  
  180. struct ISpNeed {
  181.     Str63                             name;                        /* human-readable string */
  182.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  183.     UInt8                             playerNum;                    /* used for multi-player support */
  184.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  185.     ISpElementKind                     theKind;
  186.     ISpElementLabel                 theLabel;
  187.     ISpNeedFlagBits                 flags;
  188.     UInt32                             reserved1;
  189.     UInt32                             reserved2;
  190.     UInt32                             reserved3;
  191. };
  192. typedef struct ISpNeed                    ISpNeed;
  193. #endif  /* USE_OLD_ISPNEED_STRUCT */
  194.  
  195.  
  196. enum {
  197.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  198.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  199.     kISpNeedFlag_PolledOnly        = 0x00000004,
  200.     kISpNeedFlag_EventsOnly        = 0x00000008,                    /* *** kISpElementKind specific flags ****/
  201.                                                                 /* these are flags specific to kISpElementKind_Button*/
  202.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  203.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  204.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  205.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  206.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  207.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  208.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  209.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  210.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  211.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  212.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  213.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  214. };
  215.  
  216. /*
  217.  *
  218.  * These are the current built values for ISpDeviceClass
  219.  *
  220.  */
  221.  
  222. enum {
  223.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  224.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  225.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  226.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  227.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  228.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  229.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  230.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  231.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  232. };
  233.  
  234. /*
  235.  * These are the current built in ISpElementKind's
  236.  * 
  237.  * These are all OSTypes.
  238.  *
  239.  */
  240.  
  241. enum {
  242.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  243.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  244.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  245.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  246.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  247.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  248. };
  249.  
  250.  
  251. /*
  252.  *
  253.  * These are the current built in ISpElementLabel's
  254.  *
  255.  * These are all OSTypes.
  256.  *
  257.  */
  258. #if USE_OLD_INPUT_SPROCKET_LABELS
  259.  
  260. enum {
  261.                                                                 /* axis */
  262.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  263.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  264.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  265.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  266.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  267.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  268.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  269.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  270.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  271.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  272.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  273.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  274.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  275.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  276.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  277.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn')
  278. };
  279.  
  280. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  281.  
  282.  
  283. enum {
  284.                                                                 /* generic */
  285.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  286.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  287.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  288.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  289.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  290.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  291.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  292.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  293.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  294.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  295.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  296.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  297.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  298.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  299.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  300.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  301.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  302.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  303.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),        /* delta */
  304.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  305.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  306.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  307.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  308.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  309.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  310.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  311.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  312.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,    /* direction pad */
  313.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  314.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  315.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  316.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  317.                                                                 /* buttons */
  318.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  319.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  320.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  321.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt'),    /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  322.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  323.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  324.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  325.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  326.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  327.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  328.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  329.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  330.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  331.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  332.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  333.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  334.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  335.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  336.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  337.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok')
  338. };
  339.  
  340. /*
  341.  *
  342.  * direction pad data & configuration information
  343.  *
  344.  */
  345.  
  346. typedef UInt32                             ISpDPadData;
  347.  
  348. enum {
  349.     kISpPadIdle                    = 0,
  350.     kISpPadLeft                    = 1,
  351.     kISpPadUpLeft                = 2,
  352.     kISpPadUp                    = 3,
  353.     kISpPadUpRight                = 4,
  354.     kISpPadRight                = 5,
  355.     kISpPadDownRight            = 6,
  356.     kISpPadDown                    = 7,
  357.     kISpPadDownLeft                = 8
  358. };
  359.  
  360.  
  361. struct ISpDPadConfigurationInfo {
  362.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  363.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  364. };
  365. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  366. /*
  367.  *
  368.  * button data & configuration information
  369.  *
  370.  */
  371.  
  372. typedef UInt32                             ISpButtonData;
  373.  
  374. enum {
  375.     kISpButtonUp                = 0,
  376.     kISpButtonDown                = 1
  377. };
  378.  
  379.  
  380. struct ISpButtonConfigurationInfo {
  381.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  382. };
  383. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  384. /*
  385.  *
  386.  * axis data & configuration information 
  387.  *
  388.  */
  389.  
  390. typedef UInt32                             ISpAxisData;
  391.  
  392. #define    kISpAxisMinimum  0x00000000U
  393. #define    kISpAxisMiddle   0x7FFFFFFFU
  394. #define    kISpAxisMaximum  0xFFFFFFFFU
  395.  
  396.  
  397. struct ISpAxisConfigurationInfo {
  398.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  399. };
  400. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  401.  
  402. typedef Fixed                             ISpDeltaData;
  403.  
  404. struct ISpDeltaConfigurationInfo {
  405.     UInt32                             reserved1;
  406.     UInt32                             reserved2;
  407. };
  408. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  409.  
  410. struct ISpMovementData {
  411.     ISpAxisData                     xAxis;
  412.     ISpAxisData                     yAxis;
  413.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  414. };
  415. typedef struct ISpMovementData            ISpMovementData;
  416.  
  417. struct ISpMovementConfigurationInfo {
  418.     UInt32                             reserved1;
  419.     UInt32                             reserved2;
  420. };
  421. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  422.  
  423. enum {
  424.     kISpVirtualElementFlag_UseTempMem = 1
  425. };
  426.  
  427.  
  428. enum {
  429.     kISpElementListFlag_UseTempMem = 1
  430. };
  431.  
  432.  
  433. enum {
  434.     kISpFirstIconSuite            = 30000,
  435.     kISpLastIconSuite            = 30100,
  436.     kISpNoneIconSuite            = 30000
  437. };
  438.  
  439.  
  440. #if TARGET_RT_MAC_CFM
  441. /* ********************* user level functions ********************* */
  442. /*
  443.  *
  444.  * startup / shutdown
  445.  *
  446.  */
  447. EXTERN_API_C( OSStatus )
  448. ISpStartup                        (void);
  449.  
  450. /* 1.1 or later*/
  451. EXTERN_API_C( OSStatus )
  452. ISpShutdown                        (void);
  453.  
  454. /* 1.1 or later*/
  455. /*
  456.  *
  457.  * polling
  458.  *
  459.  */
  460. EXTERN_API_C( OSStatus )
  461. ISpTickle                        (void);
  462.  
  463. /* 1.1 or later*/
  464. /********** user interface functions **********/
  465.  
  466. EXTERN_API_C( NumVersion )
  467. ISpGetVersion                    (void);
  468.  
  469. /*
  470.  *
  471.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  472.  *
  473.  */
  474. EXTERN_API_C( OSStatus )
  475. ISpElement_NewVirtual            (UInt32                 dataSize,
  476.                                  ISpElementReference *    outElement,
  477.                                  UInt32                 flags);
  478.  
  479. /*
  480.  *
  481.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  482.  *
  483.  */
  484. EXTERN_API_C( OSStatus )
  485. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  486.                                  ISpNeed *                needs,
  487.                                  ISpElementReference *    outElements,
  488.                                  UInt32                 flags);
  489.  
  490. /*
  491.  *
  492.  * ISpElement_DisposeVirtual(inElement);
  493.  *
  494.  */
  495. EXTERN_API_C( OSStatus )
  496. ISpElement_DisposeVirtual        (UInt32                 count,
  497.                                  ISpElementReference *    inElements);
  498.  
  499. /*
  500.  * ISpInit
  501.  *
  502.  */
  503. EXTERN_API_C( OSStatus )
  504. ISpInit                            (UInt32                 count,
  505.                                  ISpNeed *                needs,
  506.                                  ISpElementReference *    inReferences,
  507.                                  OSType                 appCreatorCode,
  508.                                  OSType                 subCreatorCode,
  509.                                  UInt32                 flags,
  510.                                  short                     setListResourceId,
  511.                                  UInt32                 reserved);
  512.  
  513.  
  514. /*
  515.  * ISpConfigure
  516.  *
  517.  */
  518. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  519. EXTERN_API_C( OSStatus )
  520. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  521.  
  522. /*
  523.  *
  524.  * ISpStop
  525.  *
  526.  */
  527. EXTERN_API_C( OSStatus )
  528. ISpStop                            (void);
  529.  
  530. /*
  531.  *
  532.  * ISpSuspend, ISpResume
  533.  *
  534.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  535.  * ISpResume resumes to the previous state of the system after a suspend call.
  536.  * 
  537.  * Return Codes
  538.  * memFullErr
  539.  *
  540.  */
  541. EXTERN_API_C( OSStatus )
  542. ISpSuspend                        (void);
  543.  
  544. EXTERN_API_C( OSStatus )
  545. ISpResume                        (void);
  546.  
  547. /*
  548.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  549.  *
  550.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  551.  *
  552.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  553.  * buffer - a pointer to your buffer
  554.  * outCount - contains the number of devices in the system
  555.  *
  556.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  557.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  558.  *
  559.  * Return Codes
  560.  * paramErr
  561.  *
  562.  */
  563. EXTERN_API_C( OSStatus )
  564. ISpDevices_Extract                (UInt32                 inBufferCount,
  565.                                  UInt32 *                outCount,
  566.                                  ISpDeviceReference *    buffer);
  567.  
  568. EXTERN_API_C( OSStatus )
  569. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  570.                                  UInt32                 inBufferCount,
  571.                                  UInt32 *                outCount,
  572.                                  ISpDeviceReference *    buffer);
  573.  
  574. EXTERN_API_C( OSStatus )
  575. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  576.                                  UInt32                 inBufferCount,
  577.                                  UInt32 *                outCount,
  578.                                  ISpDeviceReference *    buffer);
  579.  
  580.  
  581. /*
  582.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  583.  *
  584.  * ISpDevices_Activate, ISpDevices_Deactivate
  585.  *
  586.  * This will activate/deactivate a block of devices.
  587.  * inDeviceCount - the number of devices to activate / deactivate
  588.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  589.  *
  590.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  591.  * inClass - the class of devices to activate or deactivate
  592.  *
  593.  * ISpDevice_IsActive
  594.  * inDevice - the device reference that you wish to 
  595.  * outIsActive - a boolean value that is true when the device is active
  596.  *
  597.  * Return Codes
  598.  * paramErr
  599.  *
  600.  */
  601. EXTERN_API_C( OSStatus )
  602. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  603.  
  604. /* 1.1 or later*/
  605. EXTERN_API_C( OSStatus )
  606. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  607.  
  608. /* 1.1 or later*/
  609. EXTERN_API_C( OSStatus )
  610. ISpDevices_Activate                (UInt32                 inDeviceCount,
  611.                                  ISpDeviceReference *    inDevicesToActivate);
  612.  
  613. EXTERN_API_C( OSStatus )
  614. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  615.                                  ISpDeviceReference *    inDevicesToDeactivate);
  616.  
  617. EXTERN_API_C( OSStatus )
  618. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  619.                                  Boolean *                outIsActive);
  620.  
  621. /*
  622.  * ISpDevice_GetDefinition
  623.  *
  624.  *
  625.  * inDevice - the device you want to get the definition for
  626.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  627.  * outStruct - a pointer to where you want the structure copied
  628.  *
  629.  * Return Codes
  630.  * paramErr
  631.  *
  632.  */
  633. EXTERN_API_C( OSStatus )
  634. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  635.                                  UInt32                 inBuflen,
  636.                                  ISpDeviceDefinition *    outStruct);
  637.  
  638.  
  639. /*
  640.  *
  641.  * ISpDevice_GetElementList
  642.  *
  643.  * inDevice - the device whose element list you wish to get
  644.  * outElementList - a pointer to where you want a reference to that list stored
  645.  *
  646.  * Return Codes
  647.  * paramErr
  648.  *
  649.  */
  650. EXTERN_API_C( OSStatus )
  651. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  652.                                  ISpElementListReference * outElementList);
  653.  
  654. /*
  655.  *
  656.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  657.  * no group
  658.  *
  659.  * Return Codes
  660.  * paramErr
  661.  *
  662.  */
  663. EXTERN_API_C( OSStatus )
  664. ISpElement_GetGroup                (ISpElementReference     inElement,
  665.                                  UInt32 *                outGroup);
  666.  
  667. /*
  668.  *
  669.  * takes an ISpElementReference and returns the device that the element belongs 
  670.  * to.
  671.  *
  672.  * Return Codes
  673.  * paramErr if inElement is 0 or outDevice is nil
  674.  *
  675.  */
  676. EXTERN_API_C( OSStatus )
  677. ISpElement_GetDevice            (ISpElementReference     inElement,
  678.                                  ISpDeviceReference *    outDevice);
  679.  
  680. /*
  681.  *
  682.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  683.  * the set of standard information.  You get ISpElementKind specific information
  684.  * through ISpElement_GetConfigurationInfo.
  685.  *
  686.  * Return Codes
  687.  * paramErr if inElement is 0 or outInfo is nil
  688.  *
  689.  */
  690. EXTERN_API_C( OSStatus )
  691. ISpElement_GetInfo                (ISpElementReference     inElement,
  692.                                  ISpElementInfoPtr         outInfo);
  693.  
  694. /*
  695.  *
  696.  *         
  697.  *
  698.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  699.  * 
  700.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  701.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  702.  * will return something error.
  703.  *
  704.  * Return Codes
  705.  * paramErr if inElement or configInfo is nil
  706.  *
  707.  */
  708. EXTERN_API_C( OSStatus )
  709. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  710.                                  UInt32                 buflen,
  711.                                  void *                    configInfo);
  712.  
  713. /*
  714.  *
  715.  * ISpElement_GetSimpleState
  716.  *
  717.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  718.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  719.  * whose data fits in a signed 32 bit integer.
  720.  *
  721.  *
  722.  *
  723.  * Return Codes
  724.  * paramErr if inElement is 0 or state is nil
  725.  *
  726.  */
  727. EXTERN_API_C( OSStatus )
  728. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  729.                                  UInt32 *                state);
  730.  
  731. /*
  732.  *
  733.  * ISpElement_GetComplexState
  734.  *
  735.  * Takes an ISpElementReference and returns the current state of that element.  
  736.  * Will copy up to buflen bytes of the current state of the device into
  737.  * state.
  738.  *
  739.  *
  740.  * Return Codes
  741.  * paramErr if inElement is 0 or state is nil
  742.  *
  743.  */
  744. EXTERN_API_C( OSStatus )
  745. ISpElement_GetComplexState        (ISpElementReference     inElement,
  746.                                  UInt32                 buflen,
  747.                                  void *                    state);
  748.  
  749.  
  750. /*
  751.  * ISpElement_GetNextEvent
  752.  *
  753.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  754.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  755.  * was not enough space to fill in the whole event structure that event will be
  756.  * dequed, as much of the event as will fit in the buffer will by copied and
  757.  * ISpElement_GetNextEvent will return an error.
  758.  *
  759.  * Return Codes
  760.  * paramErr
  761.  *
  762.  */
  763. EXTERN_API_C( OSStatus )
  764. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  765.                                  UInt32                 bufSize,
  766.                                  ISpElementEventPtr     event,
  767.                                  Boolean *                wasEvent);
  768.  
  769. /*
  770.  *
  771.  * ISpElement_Flush
  772.  *
  773.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  774.  * that any events that made it to this layer before the time of the flush call will be flushed and
  775.  * it will not flush any events that make it to this layer after the time when the call has returned.
  776.  * What happens to events that occur during the flush is undefined.
  777.  *
  778.  *
  779.  * Return Codes
  780.  * paramErr
  781.  *
  782.  */
  783. EXTERN_API_C( OSStatus )
  784. ISpElement_Flush                (ISpElementReference     inElement);
  785.  
  786.  
  787.  
  788. /*
  789.  * ISpElementList_New
  790.  *
  791.  * Creates a new element list and returns it in outElementList.  In count specifies 
  792.  * the number of element references in the list pointed to by inElements.  If inCount
  793.  * is non zero the list is created with inCount elements in at as specified by the 
  794.  * inElements parameter.  Otherwise the list is created empty.
  795.  *
  796.  *
  797.  * Return Codes
  798.  * out of memory - If it failed to allocate the list because it was out of memory
  799.                    it will also set outElementList to 0
  800.  * paramErr if outElementList was nil
  801.  *
  802.  *
  803.  * Special Concerns
  804.  *
  805.  * interrupt unsafe
  806.  *
  807.  */
  808. EXTERN_API_C( OSStatus )
  809. ISpElementList_New                (UInt32                 inCount,
  810.                                  ISpElementReference *    inElements,
  811.                                  ISpElementListReference * outElementList,
  812.                                  UInt32                 flags);
  813.  
  814. /*
  815.  * ISpElementList_Dispose
  816.  *
  817.  * Deletes an already existing memory list.  
  818.  *
  819.  *
  820.  * Return Codes
  821.  * paramErr if inElementList was 0
  822.  *
  823.  *
  824.  * Special Concerns
  825.  *
  826.  * interrupt unsafe
  827.  *
  828.  */
  829. EXTERN_API_C( OSStatus )
  830. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  831.  
  832. /*
  833.  * ISpGetGlobalElementList
  834.  *
  835.  * returns the global element list
  836.  *
  837.  * Return Codes
  838.  * paramErr if outElementList is nil
  839.  *
  840.  */
  841. EXTERN_API_C( OSStatus )
  842. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  843.  
  844. /*
  845.  * ISpElementList_AddElement
  846.  *
  847.  * adds an element to the element list
  848.  *
  849.  * Return Codes
  850.  * paramErr if inElementList is 0 or newElement is 0
  851.  * memory error if the system is unable to allocate enough memory
  852.  *
  853.  * Special Concerns
  854.  * interrupt Unsafe
  855.  * 
  856.  */
  857. EXTERN_API_C( OSStatus )
  858. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  859.                                  UInt32                 refCon,
  860.                                  UInt32                 count,
  861.                                  ISpElementReference *    newElements);
  862.  
  863. /*
  864.  * ISpElementList_RemoveElement
  865.  *
  866.  * removes the specified element from the element list
  867.  *
  868.  * Return Codes
  869.  * paramErr if inElementList is 0 or oldElement is 0
  870.  * memory error if the system is unable to allocate enough memory
  871.  *
  872.  * Special Concerns
  873.  * interrupt Unsafe
  874.  * 
  875.  */
  876. EXTERN_API_C( OSStatus )
  877. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  878.                                  UInt32                 count,
  879.                                  ISpElementReference *    oldElement);
  880.  
  881. /*
  882.  * ISpElementList_Extract
  883.  *
  884.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  885.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  886.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  887.  * that number and the size of the array into the buffer.
  888.  *
  889.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  890.  * that have the specified kind and label.
  891.  *
  892.  * Return Codes
  893.  * paramErr
  894.  *
  895.  */
  896. EXTERN_API_C( OSStatus )
  897. ISpElementList_Extract            (ISpElementListReference  inElementList,
  898.                                  UInt32                 inBufferCount,
  899.                                  UInt32 *                outCount,
  900.                                  ISpElementReference *    buffer);
  901.  
  902. EXTERN_API_C( OSStatus )
  903. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  904.                                  ISpElementKind         inKind,
  905.                                  UInt32                 inBufferCount,
  906.                                  UInt32 *                outCount,
  907.                                  ISpElementReference *    buffer);
  908.  
  909. EXTERN_API_C( OSStatus )
  910. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  911.                                  ISpElementLabel         inLabel,
  912.                                  UInt32                 inBufferCount,
  913.                                  UInt32 *                outCount,
  914.                                  ISpElementReference *    buffer);
  915.  
  916. /*
  917.  * ISpElementList_GetNextEvent
  918.  *
  919.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  920.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  921.  * was not enough space to fill in the whole event structure that event will be
  922.  * dequed, as much of the event as will fit in the buffer will by copied and
  923.  * ISpElementList_GetNextEvent will return an error.
  924.  *
  925.  * Return Codes
  926.  * paramErr
  927.  *
  928.  */
  929. EXTERN_API_C( OSStatus )
  930. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  931.                                  UInt32                 bufSize,
  932.                                  ISpElementEventPtr     event,
  933.                                  Boolean *                wasEvent);
  934.  
  935. /*
  936.  *
  937.  * ISpElementList_Flush
  938.  *
  939.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  940.  * that any events that made it to this layer before the time of the flush call will be flushed and
  941.  * it will not flush any events that make it to this layer after the time when the call has returned.
  942.  * What happens to events that occur during the flush is undefined.
  943.  *
  944.  *
  945.  * Return Codes
  946.  * paramErr
  947.  *
  948.  */
  949. EXTERN_API_C( OSStatus )
  950. ISpElementList_Flush            (ISpElementListReference  inElementList);
  951.  
  952. /*
  953.  *
  954.  * ISpTimeToMicroseconds
  955.  *
  956.  *
  957.  * This function takes time from an input sprocket event and converts it
  958.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  959.  *
  960.  *
  961.  * Return Codes
  962.  * paramErr
  963.  *
  964.  */
  965. EXTERN_API_C( OSStatus )
  966. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  967.                                  UnsignedWide *            outMicroseconds);
  968.  
  969. #endif  /* TARGET_RT_MAC_CFM */
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976. #if PRAGMA_STRUCT_ALIGN
  977.     #pragma options align=reset
  978. #elif PRAGMA_STRUCT_PACKPUSH
  979.     #pragma pack(pop)
  980. #elif PRAGMA_STRUCT_PACK
  981.     #pragma pack()
  982. #endif
  983.  
  984. #ifdef PRAGMA_IMPORT_OFF
  985. #pragma import off
  986. #elif PRAGMA_IMPORT
  987. #pragma import reset
  988. #endif
  989.  
  990. #ifdef __cplusplus
  991. }
  992. #endif
  993.  
  994. #endif /* __INPUTSPROCKET__ */
  995.  
  996.